package com.wang.config;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Config {

    @Autowired
    private MinIOInfo minIOInfo;

    //问题：这里的MinioClient是单例的，有没有线程安全问题？答案：没有
    @Bean
    public MinioClient minioClient(){
        //链式编程，构造MinioClient对象
        return MinioClient.builder()
                .endpoint(minIOInfo.getEndpoint())
                .credentials(minIOInfo.getAccessKey(), minIOInfo.getSecretKey())
                .build();
    }
}